<script lang="ts">
import {defineComponent} from 'vue'

export default defineComponent({
  name: 'TeacherOption',
  data() {
    return {
      message: '老师组件'
    }

  },mounted() {
    this.$bus.$on('messageSent', (data) => {
      console.log("我是老师组件，我收到的消息是：", data);
    });
  },
  beforeDestroy() {
    this.$bus.off('messageSent');
  }
})
</script>

<template>
  <div class="teacher">
    <h2>{{ message }}</h2>
    <hr/>
  </div>
</template>

<style scoped>
  .teacher {
    background-color: yellow;
  }
</style>